import {getMyInfo} from '@a/user.js'

import { uploadImg } from "@a/common.js";
export const getTimes = () => {
  const date = new Date();
  let year = padS(date.getFullYear());
  let month = padS(date.getMonth() + 1);
  let day = padS(date.getDate());
  let hour = padS(date.getHours());
  let minute = padS(date.getMinutes());
  let second = padS(date.getSeconds());
  return `${year}/${month}/${day} ${hour}:${minute}:${second}`
}
function padS(time) {
  return time < 10 ? String(time).padStart(2, '0') : time
}

export const getMy = (_this) => {
  getMyInfo().then (res => {
    if (res.code == 200) {
      _this.$store.commit("setUser", res.data);
    }
  })
}

// export const getUploadImgPath = (file) => {
//   let params = new FormData ()
//   params.append('file', file)
//   uploadImg(params).then ( res => {
//     if ( res.code == 200) {
//       return res.data
//     } 
//   }).catch (error => {
//     return ''
//   })
// }